<template>
  <div>
    <div class="top">
      <img
        src="@/assets/image/icon/icon_4.png"
        alt=""
        class="left"
        @click="back"
      />
      <img src="@/assets/image/big_harvard.png" alt="" class="bc" />
      <span class="class">课程大纲</span>
    </div>
    <div class="titie">
      <div class="time">已开课5节</div>
      <div class="Expiration">课程有效期:2103-07-01</div>
    </div>
    <ul>
      <li v-for="item in state.list" :key="item.title">
        <!-- <img src="@/assets/image/harvard_0.png" alt="" /> -->
        <img :src="item.url" alt="" />
        <div class="right">
          <div class="li-title">{{ item.title }}</div>
          <span>{{ item.cntitle }}</span>
          <p v-if="item.isclass">未上课</p>
        </div>
      </li>
    </ul>
  </div>
</template>

<script>
import { getHaFuApi } from "../../utils/api";
import { onMounted, reactive } from "vue";
import { useRoute, useRouter } from "vue-router";
export default {
  setup() {
    const state = reactive({
      list: [],
    });
    const route = useRoute();
    const router = useRouter();
    onMounted(() => {
      listData();
    });
    const listData = async () => {
      const res = await getHaFuApi();
      if (res.status == 0) {
        state.list = res.result.list;
        console.log(state.list);
      }
    };
    const back = () => {
      router.go(-1);
    };
    return {
      state,
      listData,
      back,
      route,
      router,
    };
  },
};
</script>

<style lang="less" scoped>
.top {
  width: 100%;
  position: relative;
  .bc {
    width: 100%;
  }
  .class {
    display: block;
    width: 70px;
    height: 25px;
    border: 3px solid #fff;
    border-radius: 10%;
    position: absolute;
    right: 30px;
    top: 28px;
    line-height: 20px;
    color: #fff;
    font-size: 16px;
  }
  .left {
    height: 14px;
    position: absolute;
    left: 30px;
    top: 30px;
  }
}
.titie {
  width: 100%;
  position: relative;
  .time {
    background: #eae9e9;
    font-size: 12px;
    color: #686969;
    width: 70px;
    height: 20px;
    margin-left: 20px;
    border-radius: 20px;
    text-align: center;
    margin-top: 10px;
    line-height: 20px;
  }
  .Expiration {
    background: #eae9e9;
    font-size: 12px;
    color: #686969;
    border-radius: 20px;
    width: 170px;
    height: 20px;
    text-align: center;
    line-height: 20px;
    position: absolute;
    right: 20px;
    top: 0px;
  }
}
ul {
  width: 100%;
  li {
    width: 280px;
    height: 120px;
    border-bottom: 3px solid #eef3f5;
    margin-left: 10px;
    display: flex;
    margin-top: 20px;
    .right {
      margin-left: 10px;
    }
    .li-title {
      font-size: 22px;
    }
    img {
      width: 150px;
      height: 100px;
    }
    span {
      display: block;
      color: #bbc4cd;
      font-size: 17px;
      width: 102px;
      height: 22px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      margin-top: 8px;
    }
    p {
      font-size: 16px;
      color: #141010;
      margin-top: 22px;
      font-weight: 600;
    }
  }
}
</style>
